{extend name="common/application" /}
{block name="title"}
<title>人才培训-更多师资</title>
{/block}
{block name="css"}
<link rel="stylesheet" type="text/css" href="_CSS_/train.css" />
<script src="//api.html5media.info/1.2.2/html5media.min.js"></script>
<!--[if lt IE 9]>
<script src="http://www.ijquery.cn/js/html5shiv.js"></script>
<![endif]-->
{/block}


{block name="navbar"}{include file="/common/navbar" /}{/block}
{block name="content"}

<!-- 主体内容 -->
<div class="main">
    <div class="mainBody normalBox clearfix" style="padding-top: 0px;">
        <!--面包屑导航-->
        <div class="breadcrumb">
            <p>当前位置：
                <a href="index.html">人才培训</a> &gt;
                <a class="curPage" href="javascript:;">学术·师资</a>
            </p>
        </div>
        <!--更多人才-->
        <div class="personnels sectionArea normalBox" style="margin-top: 0px;">
            <!--人才分类-->
            <div class="courseMenu">
                <div class="courseType">
                    <ul>
                        <li>
                            <a class="courseTypeItem active" href="javascript:;">
                                <span class="icons icon-teacher hide"></span>
                                <span class="icons icon-teacher-active"></span>全部师资
                            </a>
                        </li>
                        <li>
                            <a class="courseTypeItem" href="javascript:;">
                                <span class="icons icon-professor"></span>
                                <span class="icons icon-professor-active hide"></span>高级教授
                            </a>
                        </li>
                        <li class="mr0">
                            <a class="courseTypeItem" href="javascript:;">
                                <span class="icons icon-lectuer"></span>
                                <span class="icons icon-lectuer-active hide"></span>高级讲师
                            </a>
                        </li>
                    </ul>
                </div>
                <div class="personSelect normalBox clearfix">
                    <!--省份选择-->
                    <div class="citySelect fr">
                        <label for="city">选择省份：</label>
                        <select name="city" id="city">
                            <option value="0">请选择</option>

                        </select>
                    </div>
                    <!--工作单位-->
                    <div class="jobSelect fl">
                        <label for="job">工作单位：</label>
                        <input class="fillJob" type="text" value="" placeholder="请输入工作单位" name="job"/>
                        <span class="icons icon-arrow"></span>
                        <label for="areas">研究领域：</label>
                        <input class="fillArea" type="text" value="" placeholder="请输入研究领域" name="areas"/>
                        <input type="button" value="确定" style="margin-left: 20px;">
                    </div>
                </div>
            </div>
            <div class="conBody" style="min-height: 500px;">
                <!--查询不出数据-->
                <!--<div class="nodatas normalBox">-->
                <!--<img src="_IMG_/nodata.png"/>-->
                <!--<p>抱歉，找不到相关数据</p>-->
                <!--</div>-->


            </div>
            <!--分页-->
            <div id="page"></div>
            <!--<div class="pagination" id="pagination">-->
            <!--<a href="javascript:;" class="page-prev">-->
            <!--<span class="icons icon-backward"></span>-->
            <!--</a>-->
            <!--<a href="javascript:;" class="current">1</a>-->
            <!--<a href="javascript:;">2</a>-->
            <!--<a href="javascript:;">3</a>-->
            <!--<a href="javascript:;">4</a>-->
            <!--<a href="javascript:;">5</a>-->
            <!--<a href="javascript:;" class="more" style="background:#f3f3f3 !important;">...</a>-->
            <!--<a href="javascript:;">13</a>-->
            <!--<a href="javascript:;" class="page-next">-->
            <!--<span class="icons icon-forward"></span>-->
            <!--</a>-->
            <!--</div>-->
        </div>
    </div>
</div>
{/block}

{block name="js"}
<script type="text/javascript">
    $(function () {
        talent_list(1);
        $.ajax({
            type: "get",
            url: "/index.php/api/talent/province",
            dataType: 'jsonp',
            success: function (msg) {
                if (msg.code == 200) {
                    var html = "";
                    for (var i = 0; i < msg.data.provice.length; i++) {
                        html += '<option value="' + msg.data.provice[i].id + '">' + msg.data.provice[i].province + '</option>';
                    }
                    $("#city").append(html);
                }
            }
        })
    });
    $("#city").on('change', function () {
        talent_list(1);
    });
    $('.courseTypeItem').on('click', function () {
        $('.courseTypeItem').removeClass('active');
        $('.courseTypeItem').find("span:eq(0)").removeClass('hide');
        $('.courseTypeItem').find("span:eq(1)").addClass('hide');
        $(this).addClass('active');
        $(this).find("span:eq(0)").addClass('hide');
        $(this).find("span:eq(1)").removeClass('hide');
        talent_list(1);
    });
    $("input[type='button']").on('click', function () {
        talent_list(1);
    });

    function talent_list(page) {
        var type = $('.courseType').find("ul li a").index($(".courseTypeItem[class*='active']"));
        var role = type ? (type + 3) : type;
        var workplace = $(".fillJob").val();
        var province = $("#city").val();
        var field = $('.fillArea').val();
        $.ajax({
            type: "get",
            url: "/index.php/api/talent/talent_index",
            data: {
                'sheet': 2,
                'number': 18,
                'status': 1,
                "talentrole": role,
                'page': page,
                'work': workplace,
                'area': province,
                'field': field
            },
            dataType: 'jsonp',
            success: function (msg) {
                var html = "";
                var re = /^[0-9]+$/;
                if (msg.code == 200) {
                    var len = msg.data.data.length;
                    if (len == 0) {
                        html += '<div class="nodatas normalBox"><img src="/static/web/images/nodata.png"/><p>抱歉，找不到相关数据</p></div>';
                    } else {
                        for (var i = 0; i < len; i++) {
                            var arr = msg.data.data[i].label.split(" ");
                            var label = "";
                            for (var m = 0; m < arr.length; m++) {
                                if (arr[m]) {
                                    label += '<span class="labels">' + arr[m] + '</span>';
                                }
                            }
                            if (re.test((i + 1) / 3)) {
                                html += '<div class="personInfo sectionItem mr0"><div class="userImg">';
                            } else {
                                html += '<div class="personInfo sectionItem"><div class="userImg">';
                            }
                            html += '<a class="links" href="persons_details.html?type=2&id=' + msg.data.data[i].id + '">';
                            html += '<img src="/static/web/images/76.png" class="icon-wapper">';
                            html += '<img src="/Images/Talent/' + msg.data.data[i].img_url + '" class="icon"></a></div>';
                            html += '<a class="links username" href="persons_details.html?type=2&id=' + msg.data.data[i].id + '">' + msg.data.data[i].talentname + '</a>';
                            html += '<p class="position">' + msg.data.data[i].rolename + '</p>';
                            html += '<p class="position">' + label + '</p>';
                            html += '<div class="areas moreline" limit="54">' + msg.data.data[i].field.substring(0, 54) + '</div></div>';
                        }

                    }
                    $('.conBody').html(html);
                    $('#page').html(msg.data.render);
                    $("#pagination").delegate("a", "click", function () {
                        var num = $(this).attr("num");
                        if (num) {
                            talent_list(num);
                        }
                    });
                }
            }
        })
    }
</script>
{/block}
